// package com.jeesite.modules.dataScreen.config;
//
// import com.baomidou.mybatisplus.core.MybatisConfiguration;
// import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
// import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
// import org.apache.ibatis.logging.stdout.StdOutImpl;
// import org.apache.ibatis.session.SqlSessionFactory;
// import org.mybatis.spring.SqlSessionTemplate;
// import org.mybatis.spring.annotation.MapperScan;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.beans.factory.annotation.Qualifier;
// import org.springframework.boot.context.properties.ConfigurationProperties;
// import org.springframework.boot.jdbc.DataSourceBuilder;
// import org.springframework.context.annotation.Bean;
// import org.springframework.context.annotation.Configuration;
// import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
// import org.springframework.jdbc.datasource.DataSourceTransactionManager;
//
// import javax.sql.DataSource;
//
// /**
//  * @author: mumu
//  * @date: 2024/5/16 11:45
//  */
// // @Configuration
// // @MapperScan(basePackages = "com.jeesite.modules.dataScreen.dao.themedb",sqlSessionFactoryRef = "sqlSessionFactoryThemeDb",sqlSessionTemplateRef = "sqlSessionTemplateThemeDb")
// public class DatasourceConfigThemeDb {
//
//     @Autowired
//     MybatisPlusInterceptor mybatisPlusInterceptor;
//
//     @Bean(name = "dataSourceThemeDb")
//     @ConfigurationProperties(prefix = "spring.datasource.theme-db")
//     public DataSource dataSource() {
//         return DataSourceBuilder.create().build();
//     }
//
//     @Bean(name = "sqlSessionFactoryThemeDb")
//     public SqlSessionFactory sqlSessionFactory(@Qualifier("dataSourceThemeDb") DataSource dataSource) throws Exception {
//         // SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
//         MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
//         bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:mapper/monitor/*.xml"));
// //        bean.setGlobalConfig(globalConfig);
//         bean.setPlugins(mybatisPlusInterceptor);
//         bean.setDataSource(dataSource);
//
//         // https://blog.csdn.net/weixin_41785851/article/details/119739897
//         MybatisConfiguration configuration = new MybatisConfiguration();
//         configuration.setMapUnderscoreToCamelCase(true);
//         // 配置打印sql语句
//         configuration.setLogImpl(StdOutImpl.class);
//         bean.setConfiguration(configuration);
//         return bean.getObject();
//     }
//
//     @Bean(name = "transactionManagerThemeDb")
//     public DataSourceTransactionManager transactionManager(@Qualifier("dataSourceThemeDb") DataSource dataSource) {
//         return new DataSourceTransactionManager(dataSource);
//     }
//
//     @Bean(name = "sqlSessionTemplateThemeDb")
//     public SqlSessionTemplate sqlSessionTemplate(@Qualifier("sqlSessionFactoryThemeDb") SqlSessionFactory sqlSessionFactory) {
//         return new SqlSessionTemplate(sqlSessionFactory);
//     }
//
// }
